package com.lagou.service.impI;

import com.lagou.dao.AccountDao;
import com.lagou.service.AccountService;
import com.lagou.utils.TransactionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author wsl
 * @Date 2021/11/10 21:10
 * @Project_Name jdbc_spring
 */
@Service("accountService")
public class AccountServiceImpI implements AccountService {

    @Autowired
    private AccountDao accountDao;

    /**
     * 转账方法  切入点  添加上事务控制的效果
     * @param outUser
     * @param inUser
     * @param money
     */
    @Override
    public void transfer(String outUser, String inUser, Double money) {

            //调用减钱的方法
            accountDao.out(outUser,money);

            //测试事务是否设置成功
            //int i= 1/0;

            //调用加钱的方法
            accountDao.in(inUser,money);

    }


    @Override
    public void save() {
        System.out.println("save方法...");
    }

    @Override
    public void update() {
        System.out.println("update方法...");
    }

    @Override
    public void delete() {
        System.out.println("delete方法...");
    }

}
